import os

from common.geovector.vector_dataset import VectorDataset


def test1():
    base_dir = os.path.dirname(__file__)
    fpath_geojson = os.path.join(base_dir, "boundary_henan_yuanyang.geojson")

    vds = VectorDataset.from_file(fpath_geojson)
    # vds_subset = vds.query(conditions=[("TOWNNAME", "endswith", "镇")])
    # print(vds)
    # print(len(vds))
    # print(vds.crs)
    # print(vds._gdf)
    # print(vds_subset._gdf)
    vds.warp("EPSG:32650", inplace=True)
    # print(vds.crs)
    vds.to_file("test.gpkg")


def main(option):
    if option == 1:
        test1()
    else:
        raise ValueError("Unknown option")


if __name__ == "__main__":
    import fire

    fire.Fire(main)
